home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 8: LINUX Games / Linux Cubed Series 8 - LINUX Games.iso / games / muds / pennmush.000 / pennmush-1.50-p8-linux.tar / pennmush / attrib.h < prev    next >
C/C++ Source or Header  |  1992-12-15  |  2KB  |  66 lines

  1. #ifndef _ATTRIB_H
  2. #define _ATTRIB_H
  3.  
  4. /* hash table size constant */
  5. #define ATR_HASH_SIZE 128
  6. #define ATR_HASH_MASK 127
  7.  
  8. /* new attribute foo */
  9. typedef struct attr ATTR;
  10.  
  11. /* the attribute structure */
  12. struct attr {
  13.    char *name;                /* name of attribute */
  14.    int flags;
  15.    char *value;
  16.    int creator;
  17. };
  18.  
  19. struct boolatr {
  20.   char *name;                          /* which attribute? */
  21.   char *text;
  22. };
  23.  
  24. /* possible attribute flags */
  25. #define AF_ODARK    0x1    /* players other than owner can't see it */
  26. #define AF_DARK        0x2    /* no one can see it */
  27. #define AF_WIZARD    0x4    /* Wizard only can change it */
  28. #define AF_NUKED    0x8    /* marked for deletion from attrib list */
  29. #define AF_LOCKED    0x10    /* Only creator of attrib can change it. */
  30. #define AF_NOPROG    0x20    /* won't be searched for $ commands. */
  31. #define AF_MDARK        0x40    /* Only wizards can see it */
  32. #define AF_PRIVATE      0x80    /* Children don't inherit it */
  33. #define AF_NOCOPY       0x100   /* atr_cpy (for @clone) doesn't copy it */
  34.  
  35. /* external predefined attributes. */
  36. extern ATTR attr[];
  37.  
  38. /* easy access macros for attributes */
  39. #define s_Osucc(thing,s) atr_add(thing, "OSUCCESS", (s), (thing), NOTHING)
  40. #define s_Ofail(thing,s) atr_add(thing, "OFAILURE", (s), (thing), NOTHING)
  41. #define s_Fail(thing,s) atr_add(thing, "FAILURE", (s), (thing), NOTHING)
  42. #define s_Succ(thing,s) atr_add(thing, "SUCCESS", (s), (thing), NOTHING)
  43. #define s_Pass(thing,s) atr_add(thing, "XYXXY", (s), GOD, NOTHING)
  44. #define s_Desc(thing,s) atr_add(thing, "DESCRIBE", (s), (thing), NOTHING)
  45.  
  46. #define Astr(attrib) ((attrib)->value)
  47.  
  48. typedef struct alist ALIST;
  49.  
  50. struct alist {
  51.   ALIST *next;
  52.   ATTR *attrib; 
  53. };
  54.  
  55. #define AL_ATTR(alist)        ((alist)->attrib)
  56. #define AL_NAME(alist)        (AL_ATTR((alist))->name)
  57. #define AL_STR(alist)        (Astr(AL_ATTR((alist))))
  58. #define AL_NEXT(alist)        ((alist)->next)
  59. #define AL_CREATOR(alist)    (AL_ATTR((alist))->creator)
  60. #define AL_FLAGS(alist)        (AL_ATTR((alist))->flags)
  61. #define AL_BAD(alist)        (AL_FLAGS((alist)) & AF_NUKED)
  62.  
  63. #define AL_DISPOSE(alist)    (AL_FLAGS((alist)) |= AF_NUKED)
  64.  
  65. #endif  /* __ATTRIB_H */
  66.